﻿namespace DbUp
{
    /// <summary>
    /// This interface is provided to allow different implementations of orchestrating the update process.
    /// </summary>
    public interface IDatabaseUpgrader
    {
        /// <summary>
        /// Determines whether the database is out of date and can be upgraded.
        /// </summary>
        bool IsUpgradeRequired();

        ///<summary>
        /// Creates version record for any new migration scripts without executing them.
        /// Useful for bringing development environments into sync with automated environments
        ///</summary>
        ///<returns></returns>
        DatabaseUpgradeResult MarkAsExecuted();

        /// <summary>
        /// Performs the database upgrade.
        /// </summary>
        DatabaseUpgradeResult PerformUpgrade();

        /// <summary>
        /// Tries to connect to the database.
        /// </summary>
        /// <param name="errorMessage">Any error message encountered.</param>
        /// <returns>True if able to connect to the database, otherwise false.</returns>
        bool TryConnect(out string errorMessage);
    }
}
